<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="description" content="传说中，在数千年前的古印地安人便常用一种由夜色供给世间的灵药，来解除人类的痛，这种灵药是来自一种只会在夜间开出美丽的黄花，但于日出月隐后便雕谢的植物种子提炼出的成分。这种植物因此被命名为月见草。" />
<title>LIVING LIKE @ FLAG - 微观世界！</title>
<link type="text/css" rel="stylesheet" href="<?php echo __PUBLIC__?>/style/basic.css" />
<script type="text/javascript" src="<?php echo scURL('js/init')?>"></script>
<script type="text/javascript" src="<?php echo __PUBLIC__?>/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo __PUBLIC__?>/js/ue/editor_config.js"></script>
<script type="text/javascript" src="<?php echo __PUBLIC__?>/js/ue/editor_all_min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo __PUBLIC__?>/js/ue/themes/default/ueditor.css"/>
</head>
    
<body id="body">
	
	<div id="main">
	
	<div class="content">
		<form id="dataForm" accept-charset="utf-8" method="post" style="width:680px;">
			<p><input type="text" id="title" name="title" style="width:500px" placeholder="博文标题" />
			<p><textarea id="content" name="content"></textarea>
			<p>
			<input id="postButton" type="submit" class="button" value="好了!" />
   		</form>
	</div>
	
	</div>
	
	<script type="text/javascript">
	var editor = new baidu.editor.ui.Editor({
		emotionPath : '<?php echo __PUBLIC__?>/js/ue/dialogs/emotion/',
		UEDITOR_HOME_URL: '<?php echo __PUBLIC__?>/js/ue/',
		imagePath : '<?php echo __PUBLIC__?>/js/ue/server/upload/',
		highlightJsUrl : '<?php echo __PUBLIC__?>/js/ue/third-party/SyntaxHighlighter/shCore.js',
        highlightCssUrl : '<?php echo __PUBLIC__?>/js/ue/third-party/SyntaxHighlighter/shCoreDefault.css',
		toolbars:[
			['Bold','Italic','BlockQuote', 'Link', 'Emotion',
			'InsertImage', 'InsertVideo', 'HighlightCode', 'Source']
		],
		initialStyle: 'body{font-family:Consolas,courier,"微软雅黑";font-size:14px;}',
		minFrameHeight: 200
	});
	editor.render('content');
	editor.focus();
	editor.addListener('keyup', function(type, e) {
		if(e.ctrlKey && e.keyCode == 13 || e.keyCode == 10) {
			$('#postButton').click();
		}
		if(editor.hasContents()) {
			$('#postButton').removeClass('button-disabled');
		} else {
			$('#postButton').addClass('button-disabled');
		}
	});

	
	(function() { // 解决ueditor的一个小bug：未切换源码之前，键盘方向键会失去焦点
		$EDITORUI["edui30"]._onClick();
		setTimeout(function() {
			$EDITORUI["edui30"]._onClick();
		}, 100);
	}());
	
	$(function() {
		// 注册Thing发布动作事件
		$('#postButton').click(function() {
			var title = $.trim($('#title').val());
			if(title == '') {
				$('#title').val('').focus();
				return false;
			}
			
			if(!editor.hasContents()) return false;

			var data = {
				title : title,
				content : editor.getContent()
			};
			$.post(Scabish.host + '/user/sendBlog', data, function(response) {
				if(Scabish.analyseResponse(response)) {
					window.location.href = Scabish.host;
				}
			});
		
			return false;
		});
		
		$('#dataForm').submit(function() {
			$('#postButton').click();
			return false;
		});
	});
	</script>
	<script type="text/javascript" src="<?php echo __PUBLIC__?>/js/navigation.js"></script>
</body>
</html>